// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/base/api/DeviceDetailApi'

import EditClass from '@api/base/model/UpdateDeviceReq'
import BaseClass from '@api/base/model/DeviceDto'

const CLIENT = CORE.grpcCLIENT(Client)
const BASE = [BaseClass, 'content']

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 改 —————————————————————————————— //

  async edit({ deviceId, areaId, areaName }, TIP = '修改设备') {
    const DTO = CORE.grpcDTO(EditClass, { id: deviceId, areaId, areaName }, BASE)
    await CORE.grpc(TIP, CLIENT, 'updateDevice', DTO)
    return CORE.grpcOK(TIP)
  },
}
